package golf;

import java.sql.ResultSet;
import java.sql.SQLException;

import database.DAO;

public class Player {
	int room_no;
	int char_no;
	char creater_yn;
	char play_yn;
	int now_pos;
	int now_stroke_cnt;
	int win_cnt;
	char win_yn;
	Character character;
	int score;
	
	public Player(){}
	/*
	 * CHARNO	NUMBER
ROOMNO	NUMBER
CREATORYN	CHAR(1 BYTE)
PLAYERPLAYYN	CHAR(1 BYTE)
PLAYERNOWPOS	NUMBER
PLAYERNOWSTROKENO	NUMBER
PLAYERWINCNT	NUMBER
PLAYERWINYN	CHAR(1 BYTE)
	 */
	public Player(ResultSet rs){
		try {
			setRoom_no(rs.getInt("ROOMNO"));
			setChar_no(rs.getInt("CHARNO"));
			setCreater_yn(rs.getString("CREATORYN").charAt(0));
			setPlay_yn(rs.getString("PLAYERPLAYYN").charAt(0));
			setNow_pos(rs.getInt("PLAYERNOWPOS"));
			setNow_stroke_cnt(rs.getInt("PLAYERNOWSTROKENO"));
			setWin_cnt(rs.getInt("PLAYERWINCNT"));
			setWin_yn(rs.getString("PLAYERWINYN").charAt(0));
			
			setCharacter( DAO.getInstance().getCharacter(getChar_no()) );
			setScore( DAO.getInstance().getScore(getRoom_no(), getChar_no()) );
			
			System.out.println("Player() 완료");
		} catch (SQLException e) {
			System.out.println("Player() 실패");
			e.printStackTrace();
		}
	}
	
	
	
	public int getRoom_no() {
		return room_no;
	}
	public void setRoom_no(int room_no) {
		this.room_no = room_no;
	}
	public int getChar_no() {
		return char_no;
	}
	public void setChar_no(int char_no) {
		this.char_no = char_no;
	}
	public char getCreater_yn() {
		return creater_yn;
	}
	public void setCreater_yn(char creater_yn) {
		this.creater_yn = creater_yn;
	}
	public char getPlay_yn() {
		return play_yn;
	}
	public void setPlay_yn(char play_yn) {
		this.play_yn = play_yn;
	}
	public int getNow_pos() {
		return now_pos;
	}
	public void setNow_pos(int now_pos) {
		this.now_pos = now_pos;
	}
	public int getNow_stroke_cnt() {
		return now_stroke_cnt;
	}
	public void setNow_stroke_cnt(int now_stroke_cnt) {
		this.now_stroke_cnt = now_stroke_cnt;
	}
	public int getWin_cnt() {
		return win_cnt;
	}
	public void setWin_cnt(int win_cnt) {
		this.win_cnt = win_cnt;
	}
	public char getWin_yn() {
		return win_yn;
	}
	public void setWin_yn(char win_yn) {
		this.win_yn = win_yn;
	}
	public Character getCharacter() {
		return character;
	}
	public void setCharacter(Character character) {
		this.character = character;
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}
	
	
}
